home *** CD-ROM | disk | FTP | other *** search
/ Windows News 2007 June/July / Windows News Hors série Numéro 34 juin juillet 2007.iso / Rédaction / Astuces Internet / historique.bat < prev    next >
Encoding:
DOS Batch File  |  2007-02-17  |  2.9 KB  |  56 lines

  1. @echo off
  2. if {%1}=={} @echo syntax: Historique donnΘe&goto :EOF
  3. setlocal
  4. regedit /a "%TEMP%\DelTypedURL.TM1" "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TypedURLs"
  5. If exist "%TEMP%\DelTypedURL.VBS" goto doit
  6. @echo.dim fso, readfile, contents, writefile, objArguments, w1, w2, w3, w4, w5, w6, w7, w8 >"%TEMP%\DelTypedURL.VBS"
  7. @echo.dim FullFileName, NewFilename>>"%TEMP%\DelTypedURL.VBS"
  8. @echo.Set objArguments = Wscript.Arguments>>"%TEMP%\DelTypedURL.VBS"
  9. @echo.ps1 = 2 >>"%TEMP%\DelTypedURL.VBS"
  10. @echo.ps2 = 7 >>"%TEMP%\DelTypedURL.VBS"
  11. @echo.ps3 = 1 >>"%TEMP%\DelTypedURL.VBS"
  12. @echo.ps4 = 6 >>"%TEMP%\DelTypedURL.VBS"
  13. @echo.ps5 = 8 >>"%TEMP%\DelTypedURL.VBS"
  14. @echo.ln = 3 >>"%TEMP%\DelTypedURL.VBS"
  15. @echo.cnt=0 >>"%TEMP%\DelTypedURL.VBS"
  16. @echo.set fso = CreateObject("Scripting.FileSystemObject")>>"%TEMP%\DelTypedURL.VBS"
  17. @echo.FullFileName="%TEMP%\DelTypedURL.TM1">>"%TEMP%\DelTypedURL.VBS"
  18. @echo.NewFilename="%TEMP%\DelTypedURL.TM2">>"%TEMP%\DelTypedURL.VBS"
  19. @echo.set readfile = fso.OpenTextFile(FullFileName, 1, false)>>"%TEMP%\DelTypedURL.VBS"
  20. @echo.set writefile = fso.CreateTextFile(NewFileName, 2)>>"%TEMP%\DelTypedURL.VBS"
  21. @echo.Do until readfile.AtEndOfStream = True>>"%TEMP%\DelTypedURL.VBS"
  22. @echo.contents = readfile.ReadLine>>"%TEMP%\DelTypedURL.VBS"
  23. @echo.if MID(contents, ps3, ps3) = "[" Then>>"%TEMP%\DelTypedURL.VBS"
  24. @echo.w3 = Len(contents) - 1 >>"%TEMP%\DelTypedURL.VBS"
  25. @echo.w4 = MID(contents, ps1, w3)>>"%TEMP%\DelTypedURL.VBS"
  26. @echo.writefile.writeLine "[-" ^& w4>>"%TEMP%\DelTypedURL.VBS"
  27. @echo.end if>>"%TEMP%\DelTypedURL.VBS"
  28. @echo.w1 = Replace(contents, objArguments(0), "#")>>"%TEMP%\DelTypedURL.VBS"
  29. @echo.if w1 = contents Then>>"%TEMP%\DelTypedURL.VBS"
  30. @echo.w2 = MID(contents, ps1, ln) >>"%TEMP%\DelTypedURL.VBS"
  31. @echo.if w2 ^<^> "url" Then>>"%TEMP%\DelTypedURL.VBS"
  32. @echo.writefile.writeLine contents>>"%TEMP%\DelTypedURL.VBS"
  33. @echo.else>>"%TEMP%\DelTypedURL.VBS"
  34. @echo.w6 = MID(contents, ps3, ps2)>>"%TEMP%\DelTypedURL.VBS"
  35. @echo.w7 = len(contents) - 7 >>"%TEMP%\DelTypedURL.VBS"
  36. @echo.w8 = MID(contents, ps5, w7) >>"%TEMP%\DelTypedURL.VBS"
  37. @echo.if MID(w8, ps3, ps3) ^<^> "=" Then >>"%TEMP%\DelTypedURL.VBS"
  38. @echo.w8 = "=" ^& w8 >>"%TEMP%\DelTypedURL.VBS"
  39. @echo.end if>>"%TEMP%\DelTypedURL.VBS"
  40. @echo.cnt = cnt + 1 >>"%TEMP%\DelTypedURL.VBS"
  41. @echo.contents = """url" ^& cnt ^& """" ^& w8 >>"%TEMP%\DelTypedURL.VBS"
  42. @echo.writefile.writeLine contents>>"%TEMP%\DelTypedURL.VBS"
  43. @echo.end if>>"%TEMP%\DelTypedURL.VBS"
  44. @echo.else>>"%TEMP%\DelTypedURL.VBS"
  45. @echo.Wscript.Echo "SupprimΘ " ^& contents >>"%TEMP%\DelTypedURL.VBS"
  46. @echo.end if>>"%TEMP%\DelTypedURL.VBS"
  47. @echo.loop>>"%TEMP%\DelTypedURL.VBS"
  48. @echo.readfile.close>>"%TEMP%\DelTypedURL.VBS"
  49. @echo.writefile.close>>"%TEMP%\DelTypedURL.VBS"
  50. :doit
  51. cscript //nologo "%TEMP%\DelTypedURL.VBS" %1
  52. regedit /s "%TEMP%\DelTypedURL.TM2"
  53. del /q "%TEMP%\DelTypedURL.TM1"
  54. del /q "%TEMP%\DelTypedURL.TM2"
  55. endlocal
  56.